<template>
  <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
import DialogEditor from '@/components/DialogEditor'
import dialogMixins from '@/utils/commonDialogMixins'

export default {
  mixins: [dialogMixins],
  components: {DialogEditor},
  data() {
    return {
      dataFormConfig: {
        id: {
          hidden: true
        },
        warehouseName: {
          label: '仓库名称',
          placeholder: '请输入仓库名称'
        }
      }
    }
  },
  methods: {
    init(id) {
      this.dataForm.id = id || 0

      this.$refs.dialog.initDialog({
        dataForm: this.dataForm,
        config: this.dataFormConfig,
        dataRule: this.getNeedDataRule('warehouseName'),
        initApi: 'modelApi/modelWarehouseInfo',
        saveApi: 'modelApi/saveModelWarehouse',
        updateApi: 'modelApi/updateModelWarehouse',
        objectName: 'modelWarehouse'
      })
    }
  }
}
</script>
